<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

<div id="app">
 <cpn></cpn>
  <br>
  <cpn>
<!-- 目的是获取子组件的pLanguages  vue2.5.X 一下必须使用template模板 -->
<!--    slot1 会引用 cpn中的插槽对象-->
    <template slot-scope="slot1">
        <span v-for="item in slot1.data">{{item}} --  </span>
    </template>
  </cpn>

</div>


<template id="cpn">
  <div>
   <slot :data="pLanguages">
     <ul>
       <li v-for="item in pLanguages">{{item}}</li>
     </ul>
   </slot>
  </div>
</template>

  <script src="../js/vue.js"></script>
<script>
  const app = new Vue({
    el:'#app',
    data:{
      message:"message",

    },
    methods:{

    },
    components:{
      cpn:{
        template:'#cpn',
        data(){
          return{
            pLanguages:['java','python','C','c++']
          }
        }
      }
    }

  })
</script>

</body>
</html>